#ifndef RACING_HUD_APP_H
#define RACING_HUD_APP_H

#include <QObject>
#include <QUdpSocket>
#include "Packets.h"

class RacingHUDApp : public QObject
{
    Q_OBJECT

    Q_PROPERTY(QObject* viewModel READ viewModel WRITE setViewModel NOTIFY viewModelChanged FINAL)

public:
    RacingHUDApp(QObject* parent = nullptr);

    QObject *viewModel() const;
    void setViewModel(QObject *newViewModel);

signals:
    void viewModelChanged();

private slots:
    void processPendingDatagrams();

private:

    void processCarTelemetryData(const CarTelemetryData &carTelemetryData);
    void processCarStatusData(const CarStatusData &carStatusData);
    void processLapData(PacketLapData &lapData);

    QObject *m_viewModel = nullptr;
    QUdpSocket *m_udpSocket = nullptr;
};

#endif // RACING_HUD_APP_H
